﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Crm.Workflow;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;
using System.Net;
using System.IO;

namespace CrmContrib.Workflow.Activities.Networking
{
    [CrmWorkflowActivity("Delete File", "CrmContrib \\ Networking")]
    public class DeleteFileActivity : Activity
    {

        [CrmInput("File ID")]
        public string FileID
        {
            get { return (string)base.GetValue(DeleteFileActivity.FileIDProperty); }
            set { base.SetValue(DeleteFileActivity.FileIDProperty, value); }
        }

        public static readonly DependencyProperty FileIDProperty = DependencyProperty.Register("FileID", typeof(string), typeof(DeleteFileActivity));

        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            FileRegistry.RemoveFile(this.FileID.ToString());
            
            return base.Execute(executionContext);
        }
    }
}
